1. Field of the Invention
This invention relates in general to language grammars, and in particular, to a system for automatically generating browsable language grammars.
2. Description of Related Art
The World Wide Web (WWW) of the Internet has become the primary medium for communication and collaboration. Internet browsers have become ubiquitous as viewers and editors for documents. As a result, methods used to share, read, and update documents have changed significantly.
For example, as new specifications for programming languages, script languages, meta-data, etc., are drafted, browsable versions of these specifications are usually published on the Internet. Such specifications usually are published in the form of a grammar having production rules.
For people reading these specifications using a browser, it is useful to mark up production rules within the grammars to make them more understandable. Some publishers hand-code the production rules to make them more browsable, while other publishers do not make the production rules browsable at all.
In one example, U.S. Pat. No. 5,678,052 describes a method and system for converting a text-based Backus-Naur Form (BNF) grammar into a compressed syntax diagram. In another example, U.S. Pat. No. 5,526,522 describes an automatic program generating system that performs recursive conversion of a program specification into a syntactic tree format.
However, there is still a need then for a mechanism that automatically marks up grammar production rules to enhance their readability and accessibility. There is also a need for such mechanisms that are implemented using standardized markup languages.
To overcome the limitations in the prior art described above, and to overcome other limitations that will become apparent upon reading and understanding the present specification, the present invention discloses a method, system and article of manufacture for automatically generating browsable language grammars. A grammar specification is used to identify the structure of an input grammar, so that a specification pre-processor, grammar parser and grammar generator can work together to generate a marked up grammar that is a browsable representation of the input grammar. The specification defines how a terminal is represented, how a non-terminal is represented, how production rules are represented, etc. Using the specification, the specification pre-processor generates the grammar parser for subsequent use with production rules found in the input grammar. When an actual set of production rules of an input grammar are provided to the grammar parser, it generates an intermediate form of the grammar that is then used by the grammar generator to generate the browsable, marked up version of the input grammar.